runOnStartup(async runtime => {
    cc_Game.addEventListener("minerTick", (e) => {
    })
    cc_Game.addEventListener("minerInit", (e) => {
        Miner_Event_MinerGotoNextDay.ButtonClickGotoNextDay()
    })
});
globalThis.Miner_Event_MinerGotoNextDay = {
    ButtonClickGotoNextDay: function () {
        cc_Game.addEventListener("ButtonClick2", (e) => {
            //console.log(e.detail[0])
            var getButton = e.detail[0]
            //console.log(getButton)
            if (getButton.instVars.ID == 5) {
                 Miner_Event_MinerGotoNextDay.hookCarBackAnimation()
            }
        })
    },
    hookCarBackAnimation: function () {
        var hookCar = runtime.objects.HookCar?.getFirstInstance()
        if (hookCar == null) return
        var hookCarMove = hookCar.behaviors.MoveTo
        var hook = runtime.objects.ToolHook?.getFirstInstance()
        var hookRope = runtime.objects.rope?.getFirstInstance()
        var EndPosX =hook.x
        var EndPosY =hookCar.y
        var InitPosX =hookCar.x
        var InitPosY =hookCar.y
        cc_Game.mh_Camera.cambackInit()
        hookCarMove.moveToPosition(EndPosX, EndPosY, true)
        hookCarMove.addEventListener("arrived", function getArrived() {
            hookCarMove.removeEventListener("arrived", getArrived)
            hookCar.setAnimation("TakeMiner")
            hook.isVisible = false
            hookRope.isVisible = false
            hookCarMove.moveToPosition(InitPosX, InitPosY, true)
            hookCarMove.addEventListener("arrived", function getBack() {
                runtime.goToLayout("sReadyPage")
                hookCarMove.removeEventListener("arrived", getBack)
            })
        })
    }
}
export default Miner_Event_MinerGotoNextDay